/**
 * 
 */
package design_pattern.memento.whitebox;

/**
 * @author linzq
 * 
 */
public class Originator {

  private String state;

  /**
   * 工厂方法返回一个新的备忘录对象
   * 
   * @return
   */
  public Memento createMemento() {
    return new Memento(state);
  }

  public void restoreMemento(Memento m) {
    this.state = m.getState();
  }

  public String getState() {
    return state;

  }

  public void setState(String state) {
    this.state = state;
    System.out.println("Current state = " + state);
  }

}
